Skip to content

Add tests for artifact reparse point detection - #10721

Merged
Amaury Levé (Evangelink) merged 2 commits into
mainfrom
dev/amauryleve/test-artifact-reparse-points
Aug 25, 2026
Merged

Amaury Levé (Evangelink) merged 2 commits into
mainfrom
dev/amauryleve/test-artifact-reparse-points

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

  • add direct tests for regular directories, missing paths, plain files, and reparse-point directories
  • exercise symbolic links on modern .NET and Windows junctions on .NET Framework
  • resolve the linked internal helper through the Trx report assembly to avoid ambiguous type references

Testing

  • targeted project build for net8.0, net9.0, net462, and net472
  • ArtifactPostProcessingHelperTests on all four target frameworks
  • full Microsoft.Testing.Extensions.UnitTests net9.0 suite (1,163 tests, 0 failures)

Fixes #10710

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c661d151-50e8-4112-be24-c3144a02580e
Copilot AI balanced review requested due to automatic review settings August 25, 2026 10:14

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Automated review by GitHub Copilot. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.

# Dimension Verdict
10 Robustness & Maintainability 🟡 1 MODERATE
14 Test Isolation & Cleanup 🟡 1 MODERATE
15 Assertion Quality i️ 1 LOW

✅ 19/22 dimensions clean.


Summary: Well-structured test file covering the key cases (regular dir, non-existent path, symlink, junction, plain file). The use of Assert.Inconclusive for environment-dependent symlink/junction creation is the right pattern for CI reliability.

Two moderate concerns:

  1. Reflection fragility — the test accesses an internal helper via reflection. If an InternalsVisibleTo or a thin test-surface shim is feasible, it would improve long-term maintainability.
  2. Cleanup resilience — the TestCleanup loop can short-circuit on a single IOException, leaking remaining temp directories on flaky CI agents.

Neither is blocking for merge.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10721

GradeTestMutationNotesHow to improve
B (80–89) new ArtifactPostProcessingHelperTests.
IsReparsePoint_
SymbolicLinkToDirectory_
ReturnsTrue
1/1 killed Correctly exercises the symlink branch, but falls back to Inconclusive on any IOException/UnauthorizedAccessException/PlatformNotSupportedException, so on locked-down CI it silently skips instead of asserting. Log/emit a diagnostic count of inconclusive runs, or add a CI capability probe so silent skips are visible in coverage reports.
B (80–89) new ArtifactPostProcessingHelperTests.
IsReparsePoint_
JunctionToDirectory_
ReturnsTrue
1/1 killed Valid Windows-only junction test via mklink, but process-exit-code handling silently marks Inconclusive on failure, weakening guaranteed coverage of this branch. Assert on the specific expected failure reasons (e.g., lack of privilege) rather than treating any nonzero exit code the same way.
A (90–100) new ArtifactPostProcessingHelperTests.
IsReparsePoint_
RegularDirectory_
ReturnsFalse
1/1 killed Directly verifies the false path for an ordinary, freshly-created directory. —
A (90–100) new ArtifactPostProcessingHelperTests.
IsReparsePoint_
NonExistentPath_
ReturnsTrue
1/1 killed Exercises the catch-and-treat-as-unsafe branch for an unreadable/missing path, matching the documented contract. —
A (90–100) new ArtifactPostProcessingHelperTests.
IsReparsePoint_
File_
ReturnsFalse
1/1 killed Confirms a plain file (not a directory or reparse point) is correctly reported false. —

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Suggestions on the Files
changed tab can be applied with one click. Re-run with
/review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 53.4 AIC · ⌖ 2.36 AIC · ⊞ 16.9K · [◷]( · ◷)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds direct cross-framework coverage for reparse-point detection used to protect artifact output paths.

Changes:

  • Tests regular, missing, file, symbolic-link, and junction paths.
  • Resolves the linked helper through the Trx assembly.
  • Cleans up temporary filesystem resources.
Show a summary per file
File Description
ArtifactPostProcessingHelperTests.cs Adds MSTest coverage for IsReparsePoint.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@Evangelink
Amaury Levé (Evangelink) enabled auto-merge (squash) August 25, 2026 10:55
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c661d151-50e8-4112-be24-c3144a02580e
Copilot AI review requested due to automatic review settings August 25, 2026 11:06
@github-actions

Copy link
Copy Markdown
Contributor

🧵 Parallel-safety audit — PR #10721

Parallelization — one row per test assembly audited:

Test assembly Scope Workers Analyzer coverage
Microsoft.Testing.Extensions.UnitTests MethodLevel CPU count (Workers = 0) coverable once the parallel-safety analyzers ship (attribute-based opt-in in Program.cs)

Findings: A (global-state) 0 · B (paths) 0 · C (declaration) 0 · D (over-serialization) 0 — by severity: Critical 0 · High 0 · Warning 0 · Info 0.

This PR adds a single new test file, test/UnitTests/Microsoft.Testing.Extensions.UnitTests/ArtifactPostProcessingHelperTests.cs, with no changes to any parallelization configuration (Program.cs's [assembly: Parallelize(Scope = MethodLevel, Workers = 0)] opt-in is unchanged).

Reviewed for parallel-safety hazards:

  • Filesystem paths (category B): every path the tests create (CreateTrackedDirectory, the non-existent-path test, the symlink/junction tests) is built from Path.Combine(Path.GetTempPath(), nameof(ArtifactPostProcessingHelperTests), Guid.NewGuid().ToString("N")) — a fresh GUID leaf per call, so no two test methods (or two invocations of the same method) can converge on the same path. No collision possible.
  • Cleanup ([TestCleanup]): _trackedDirectories is an instance field, and MSTest constructs a new instance per test method, so each test only ever deletes the unique GUID subdirectories it itself created — no shared/static state, no cross-test interference.
  • Process-global state (category A): no Environment.SetEnvironmentVariable, no CWD mutation, no console redirection, no culture mutation, no mutable static fields written by any test. The only static readonly member (IsReparsePointMethod) is initialized once via reflection and only ever read.
  • Declarations (category C): no [ResourceLock] / [DoNotParallelize] are declared, and none are needed — the file touches no process-global or externally-shared resource.
  • Over-serialization (category D): not applicable — no locks or [DoNotParallelize] present to evaluate.

No parallel-safety issues found. Nothing to flag.

Advisory only — heuristic, non-blocking. Re-run with /parallel-audit. This audit answers "is it parallel-safe?"; for testability, smells, or flakiness see the detect-static-dependencies / test-smell-detection / test-anti-patterns analyses.

🤖 Automated content by GitHub Copilot. Generated by the Parallel-safety audit on PR (on open / sync) workflow. · auto · 49 AIC · ⌖ 5.1 AIC · ⊞ 24.8K · [◷]( · ◷)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review details

  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@Evangelink Amaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Aug 25, 2026
@Evangelink
Amaury Levé (Evangelink) merged commit 5ac412c into main Aug 25, 2026
39 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/test-artifact-reparse-points branch August 25, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-review Awaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[test-improver] Add unit tests for ArtifactPostProcessingHelper.IsReparsePoint

3 participants